package com.biz.imp;

import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bean.Category;
import com.biz.CategoryBiz;
import com.service.*;
@Service
@Transactional
public class CategoryBizImp implements CategoryBiz {
	@Autowired
	private MapperService mapperService;
	
	public MapperService getMapperService() {
		return mapperService;
	}

	public void setMapperService(MapperService mapperService) {
		this.mapperService = mapperService;
	}

	public int save(Category category) {
		int code=mapperService.getCategoryMapper().insert(category);
		
		return code;
	}

	public int update(Category category) {
		int code=mapperService.getCategoryMapper().updateByPrimaryKey(category);
		
		return code;
	}

	public int delById(Integer cid) {
		int code=mapperService.getCategoryMapper().deleteByPrimaryKey(cid);
		
		return code;
	}

	public Category findById(Integer cid) {
		Category category=mapperService.getCategoryMapper().selectByPrimaryKey(cid);
		return category;
	}

	public List<Category> findCategoryByPid(Integer pcid) {
		List<Category> lscatagry=mapperService.getCategoryMapper().findCategoryByPid(pcid);
		return lscatagry;
	}

}
